package cate.game.activity.limitback.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.game.GameBody;
import cate.game.activity.limitback.LimitBackActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBLimitBack;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "回退英雄 的 请求")
@OperationSetter(GDOperation.LIMIT_HERO_BACK)
public class LimitBackReq implements MsgInput {
    @NoteField("功能id")
    public int funcId;
    @NoteField("英雄uid")
    public String uid;
    @Override
    public void execute(GameBody game, ClientContext cc) {
        LimitBackActivity single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        single.back(cc.getRole(), uid);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBLimitBack.LIMIT_BACK_REQ;
    }
}
